let ajaxTime = 0

export const request=(params)=>{
  ajaxTime++
  wx.showLoading({
    title: '加载中',
    mask: true
  })
  console.log(params.url)
    
  return new Promise((resolve, reject) => {
    wx.request({
      url: params.url,
      success:(result) => {
        resolve(result.data);
      },
      fail:(err) => {
        reject(err);
      },
      complete:() => {
        ajaxTime--
        if(ajaxTime == 0) {
          wx.hideLoading();
        }
      }
    })
  })
}